namespace InventoryManagement
{
	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.ComponentModel;
	using System.Data;
	using System.Data.SqlClient;
	using System.Text;
	
	
	public class Work_Order : BaseTable
	{
		
		#region Static SQL String Members
		/// <remarks>This field represents the full SELECT string for the table Work Order, with the WHERE clause.</remarks>
		internal static string _SQL_Select = @"SELECT [ID], [NoWO], [Date], [ID_LabelName], [ID_Vendor], [Name], [PIC], [Svc_SysConfig], [Svc_Troubleshooting], [Svc_Hardware], [Svc_DataBackup], [Svc_Software], [Svc_Upgrade], [Description], [Note], [StartDate], [FinishDate], [ID_PickUp], [URLAttachment] FROM [dbo].[Work Order] WHERE [ID]=@ID ";
		
		/// <remarks>This field represents the full SELECT string for the table Work Order, with the WHERE clause.</remarks>
		internal static string _SQL_SelectByParam = "SELECT [ID], [NoWO], [Date], [ID_LabelName], [ID_Vendor], [Name], [PIC], [Svc_SysConfig], [Svc_Troubleshooting], [Svc_Hardware], [Svc_DataBackup], [Svc_Software], [Svc_Upgrade], [Description], [Note], [StartDate], [FinishDate], [ID_PickUp], [URLAttachment] FROM [dbo].[Work Order] WHERE isnull(convert(varchar(36),[ID]),\'true\')=isnull(convert(varchar(36),@ID),isnull(convert(varchar(36),[ID]),\'true\')) AND isnull(convert(varchar,[NoWO]),\'true\')=isnull(convert(varchar,@NoWO),isnull(convert(varchar,[NoWO]),\'true\')) AND isnull(convert(varchar,[Date]),\'true\')=isnull(convert(varchar,@Date),isnull(convert(varchar,[Date]),\'true\')) AND isnull(convert(varchar(36),[ID_LabelName]),\'true\')=isnull(convert(varchar(36),@ID_LabelName),isnull(convert(varchar(36),[ID_LabelName]),\'true\')) AND isnull(convert(varchar(36),[ID_Vendor]),\'true\')=isnull(convert(varchar(36),@ID_Vendor),isnull(convert(varchar(36),[ID_Vendor]),\'true\')) AND isnull(convert(varchar,[Name]),\'true\')=isnull(convert(varchar,@Name),isnull(convert(varchar,[Name]),\'true\')) AND isnull(convert(varchar,[PIC]),\'true\')=isnull(convert(varchar,@PIC),isnull(convert(varchar,[PIC]),\'true\')) AND isnull(convert(varchar,[Svc_SysConfig]),\'true\')=isnull(convert(varchar,@Svc_SysConfig),isnull(convert(varchar,[Svc_SysConfig]),\'true\')) AND isnull(convert(varchar,[Svc_Troubleshooting]),\'true\')=isnull(convert(varchar,@Svc_Troubleshooting),isnull(convert(varchar,[Svc_Troubleshooting]),\'true\')) AND isnull(convert(varchar,[Svc_Hardware]),\'true\')=isnull(convert(varchar,@Svc_Hardware),isnull(convert(varchar,[Svc_Hardware]),\'true\')) AND isnull(convert(varchar,[Svc_DataBackup]),\'true\')=isnull(convert(varchar,@Svc_DataBackup),isnull(convert(varchar,[Svc_DataBackup]),\'true\')) AND isnull(convert(varchar,[Svc_Software]),\'true\')=isnull(convert(varchar,@Svc_Software),isnull(convert(varchar,[Svc_Software]),\'true\')) AND isnull(convert(varchar,[Svc_Upgrade]),\'true\')=isnull(convert(varchar,@Svc_Upgrade),isnull(convert(varchar,[Svc_Upgrade]),\'true\')) AND isnull(convert(varchar,[Description]),\'true\')=isnull(convert(varchar,@Description),isnull(convert(varchar,[Description]),\'true\')) AND isnull(convert(varchar,[Note]),\'true\')=isnull(convert(varchar,@Note),isnull(convert(varchar,[Note]),\'true\')) AND isnull(convert(varchar,[StartDate]),\'true\')=isnull(convert(varchar,@StartDate),isnull(convert(varchar,[StartDate]),\'true\')) AND isnull(convert(varchar,[FinishDate]),\'true\')=isnull(convert(varchar,@FinishDate),isnull(convert(varchar,[FinishDate]),\'true\')) AND isnull(convert(varchar(36),[ID_PickUp]),\'true\')=isnull(convert(varchar(36),@ID_PickUp),isnull(convert(varchar(36),[ID_PickUp]),\'true\')) AND isnull(convert(varchar,[URLAttachment]),\'true\')=isnull(convert(varchar,@URLAttachment),isnull(convert(varchar,[URLAttachment]),\'true\')) ";
		
		/// <remarks>This field represents the full INSERT INTO string for the table Work Order.</remarks>
		internal static string _SQL_Insert = @"INSERT INTO [dbo].[Work Order] ([ID], [NoWO], [Date], [ID_LabelName], [ID_Vendor], [Name], [PIC], [Svc_SysConfig], [Svc_Troubleshooting], [Svc_Hardware], [Svc_DataBackup], [Svc_Software], [Svc_Upgrade], [Description], [Note], [StartDate], [FinishDate], [ID_PickUp], [URLAttachment]) VALUES(@ID, @NoWO, @Date, @ID_LabelName, @ID_Vendor, @Name, @PIC, @Svc_SysConfig, @Svc_Troubleshooting, @Svc_Hardware, @Svc_DataBackup, @Svc_Software, @Svc_Upgrade, @Description, @Note, @StartDate, @FinishDate, @ID_PickUp, @URLAttachment) ";
		
		/// <remarks>This field represents the full UPDATE string for the table Work Order, with the WHERE clause.</remarks>
		internal static string _SQL_Update = @"UPDATE [dbo].[Work Order] SET [ID] = @ID, [NoWO] = @NoWO, [Date] = @Date, [ID_LabelName] = @ID_LabelName, [ID_Vendor] = @ID_Vendor, [Name] = @Name, [PIC] = @PIC, [Svc_SysConfig] = @Svc_SysConfig, [Svc_Troubleshooting] = @Svc_Troubleshooting, [Svc_Hardware] = @Svc_Hardware, [Svc_DataBackup] = @Svc_DataBackup, [Svc_Software] = @Svc_Software, [Svc_Upgrade] = @Svc_Upgrade, [Description] = @Description, [Note] = @Note, [StartDate] = @StartDate, [FinishDate] = @FinishDate, [ID_PickUp] = @ID_PickUp, [URLAttachment] = @URLAttachment WHERE [ID]=@ID ";
		
		/// <remarks>This field represents the DELETE string for the table Work Order, with the WHERE clause.</remarks>
		internal static string _SQL_Delete = "DELETE FROM [dbo].[Work Order] WHERE [ID]=@ID ";
		#endregion
		
		#region Tables Members
		/// <remarks>SQL Type:uniqueidentifier - </remarks>
		private System.Nullable<System.Guid> _ID;
		
		[DisplayName("ID")]
		[Category("Primary Key")]
		public System.Nullable<System.Guid> ID
		{
			get
			{
				try
				{
					return _ID;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID", err);
				}
			}
			set
			{
				try
				{
					_ID = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _NoWO;
		
		[DisplayName("No WO")]
		[Category("Column")]
		public string NoWO
		{
			get
			{
				try
				{
					return _NoWO;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting NoWO", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_NoWO = value;
					}
					else
					{
						throw new OverflowException("Error setting NoWO, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting NoWO", err);
				}
			}
		}
		
		/// <remarks>SQL Type:datetime - </remarks>
		private System.Nullable<System.DateTime> _Date;
		
		[DisplayName("Date")]
		[Category("Column")]
		public System.Nullable<System.DateTime> Date
		{
			get
			{
				try
				{
					return _Date;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Date", err);
				}
			}
			set
			{
				try
				{
					_Date = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Date", err);
				}
			}
		}
		
		/// <remarks>SQL Type:uniqueidentifier - </remarks>
		private System.Nullable<System.Guid> _ID_LabelName;
		
		[DisplayName("ID_Label Name")]
		[Category("Column")]
		public System.Nullable<System.Guid> ID_LabelName
		{
			get
			{
				try
				{
					return _ID_LabelName;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_LabelName", err);
				}
			}
			set
			{
				try
				{
					_ID_LabelName = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_LabelName", err);
				}
			}
		}
		
		/// <remarks>SQL Type:uniqueidentifier - </remarks>
		private System.Nullable<System.Guid> _ID_Vendor;
		
		[DisplayName("ID_Vendor")]
		[Category("Column")]
		public System.Nullable<System.Guid> ID_Vendor
		{
			get
			{
				try
				{
					return _ID_Vendor;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_Vendor", err);
				}
			}
			set
			{
				try
				{
					_ID_Vendor = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_Vendor", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _Name;
		
		[DisplayName("Name")]
		[Category("Column")]
		public string Name
		{
			get
			{
				try
				{
					return _Name;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Name", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_Name = value;
					}
					else
					{
						throw new OverflowException("Error setting Name, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Name", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _PIC;
		
		[DisplayName("PIC")]
		[Category("Column")]
		public string PIC
		{
			get
			{
				try
				{
					return _PIC;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting PIC", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 200))
					{
						_PIC = value;
					}
					else
					{
						throw new OverflowException("Error setting PIC, Length of value is to long. Maximum Length: 200");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting PIC", err);
				}
			}
		}
		
		/// <remarks>SQL Type:bit - </remarks>
		private System.Nullable<bool> _Svc_SysConfig;
		
		[DisplayName("Svc_Sys Config")]
		[Category("Column")]
		public System.Nullable<bool> Svc_SysConfig
		{
			get
			{
				try
				{
					return _Svc_SysConfig;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Svc_SysConfig", err);
				}
			}
			set
			{
				try
				{
					_Svc_SysConfig = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Svc_SysConfig", err);
				}
			}
		}
		
		/// <remarks>SQL Type:bit - </remarks>
		private System.Nullable<bool> _Svc_Troubleshooting;
		
		[DisplayName("Svc_Troubleshooting")]
		[Category("Column")]
		public System.Nullable<bool> Svc_Troubleshooting
		{
			get
			{
				try
				{
					return _Svc_Troubleshooting;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Svc_Troubleshooting", err);
				}
			}
			set
			{
				try
				{
					_Svc_Troubleshooting = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Svc_Troubleshooting", err);
				}
			}
		}
		
		/// <remarks>SQL Type:bit - </remarks>
		private System.Nullable<bool> _Svc_Hardware;
		
		[DisplayName("Svc_Hardware")]
		[Category("Column")]
		public System.Nullable<bool> Svc_Hardware
		{
			get
			{
				try
				{
					return _Svc_Hardware;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Svc_Hardware", err);
				}
			}
			set
			{
				try
				{
					_Svc_Hardware = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Svc_Hardware", err);
				}
			}
		}
		
		/// <remarks>SQL Type:bit - </remarks>
		private System.Nullable<bool> _Svc_DataBackup;
		
		[DisplayName("Svc_Data Backup")]
		[Category("Column")]
		public System.Nullable<bool> Svc_DataBackup
		{
			get
			{
				try
				{
					return _Svc_DataBackup;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Svc_DataBackup", err);
				}
			}
			set
			{
				try
				{
					_Svc_DataBackup = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Svc_DataBackup", err);
				}
			}
		}
		
		/// <remarks>SQL Type:bit - </remarks>
		private System.Nullable<bool> _Svc_Software;
		
		[DisplayName("Svc_Software")]
		[Category("Column")]
		public System.Nullable<bool> Svc_Software
		{
			get
			{
				try
				{
					return _Svc_Software;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Svc_Software", err);
				}
			}
			set
			{
				try
				{
					_Svc_Software = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Svc_Software", err);
				}
			}
		}
		
		/// <remarks>SQL Type:bit - </remarks>
		private System.Nullable<bool> _Svc_Upgrade;
		
		[DisplayName("Svc_Upgrade")]
		[Category("Column")]
		public System.Nullable<bool> Svc_Upgrade
		{
			get
			{
				try
				{
					return _Svc_Upgrade;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Svc_Upgrade", err);
				}
			}
			set
			{
				try
				{
					_Svc_Upgrade = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Svc_Upgrade", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _Description;
		
		[DisplayName("Description")]
		[Category("Column")]
		public string Description
		{
			get
			{
				try
				{
					return _Description;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Description", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 1000))
					{
						_Description = value;
					}
					else
					{
						throw new OverflowException("Error setting Description, Length of value is to long. Maximum Length: 1000");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Description", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _Note;
		
		[DisplayName("Note")]
		[Category("Column")]
		public string Note
		{
			get
			{
				try
				{
					return _Note;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Note", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 1000))
					{
						_Note = value;
					}
					else
					{
						throw new OverflowException("Error setting Note, Length of value is to long. Maximum Length: 1000");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Note", err);
				}
			}
		}
		
		/// <remarks>SQL Type:datetime - </remarks>
		private System.Nullable<System.DateTime> _StartDate;
		
		[DisplayName("Start Date")]
		[Category("Column")]
		public System.Nullable<System.DateTime> StartDate
		{
			get
			{
				try
				{
					return _StartDate;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting StartDate", err);
				}
			}
			set
			{
				try
				{
					_StartDate = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting StartDate", err);
				}
			}
		}
		
		/// <remarks>SQL Type:datetime - </remarks>
		private System.Nullable<System.DateTime> _FinishDate;
		
		[DisplayName("Finish Date")]
		[Category("Column")]
		public System.Nullable<System.DateTime> FinishDate
		{
			get
			{
				try
				{
					return _FinishDate;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting FinishDate", err);
				}
			}
			set
			{
				try
				{
					_FinishDate = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting FinishDate", err);
				}
			}
		}
		
		/// <remarks>SQL Type:uniqueidentifier - </remarks>
		private System.Nullable<System.Guid> _ID_PickUp;
		
		[DisplayName("ID_Pick Up")]
		[Category("Column")]
		public System.Nullable<System.Guid> ID_PickUp
		{
			get
			{
				try
				{
					return _ID_PickUp;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting ID_PickUp", err);
				}
			}
			set
			{
				try
				{
					_ID_PickUp = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting ID_PickUp", err);
				}
			}
		}
		
		/// <remarks>SQL Type:varchar - </remarks>
		private string _URLAttachment;
		
		[DisplayName("URLAttachment")]
		[Category("Column")]
		public string URLAttachment
		{
			get
			{
				try
				{
					return _URLAttachment;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting URLAttachment", err);
				}
			}
			set
			{
				try
				{
					if ((value.Length <= 400))
					{
						_URLAttachment = value;
					}
					else
					{
						throw new OverflowException("Error setting URLAttachment, Length of value is to long. Maximum Length: 400");
					}
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting URLAttachment", err);
				}
			}
		}
		#endregion
		
		#region Related Object Collections
		/// <remarks>Represents the foreign key object</remarks>
		private Pick_UpCollection _Pick_UpCollection;
		
		[Description("Represents the foreign key relation. This is an Collection of Work_Order.")]
		public Pick_UpCollection Pick_UpCollection
		{
			get
			{
				try
				{
					return _Pick_UpCollection;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error getting Pick_UpCollection", err);
				}
			}
			set
			{
				try
				{
					_Pick_UpCollection = value;
				}
				catch (System.Exception err)
				{
					throw new Exception("Error setting Pick_UpCollection", err);
				}
			}
		}
		#endregion
		
		#region Public Methods
		public void Select()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Work_Order._SQL_Select;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				SqlDataReader rs = Com.ExecuteReader();
				while(rs.Read())
				{
					AddFromRecordSet(rs);
				}
				rs.Close();
				Conn.Close();
				rs.Dispose();
				Com.Dispose();
				Conn.Dispose();
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public System.Data.DataTable SelectByParam()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Work_Order._SQL_SelectByParam;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				SqlDataAdapter objDataAdapter = new SqlDataAdapter(Com);
				DataTable objDataTable = new DataTable();
				objDataAdapter.Fill(objDataTable);
				Conn.Close();
				Com.Dispose();
				Conn.Dispose();
				return objDataTable;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public int Insert()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Work_Order._SQL_Insert;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				int rowseffected = Com.ExecuteNonQuery();
				Conn.Close();
				Com.Dispose();
				Conn.Dispose();
				return rowseffected;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public int Update()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Work_Order._SQL_Update;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				int rowseffected = Com.ExecuteNonQuery();
				Conn.Close();
				Com.Dispose();
				Conn.Dispose();
				return rowseffected;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public int Delete()
		{
			try
			{
				SqlConnection Conn = new SqlConnection(_connString);
				SqlCommand Com = Conn.CreateCommand();
				Com.CommandText = Work_Order._SQL_Delete;
				Com.Parameters.AddRange(GetSqlParameters());
				Conn.Open();
				int rowseffected = Com.ExecuteNonQuery();
				Conn.Close();
				Com.Dispose();
				Conn.Dispose();
				return rowseffected;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		
		public string[] GetSqlCommandStrings()
		{
			try
			{
				string[] CommStr = new string[4];
				CommStr[0] = "SELECT [ID], [NoWO], [Date], [ID_LabelName], [ID_Vendor], [Name], [PIC], [Svc_SysConfig], [Svc_Troubleshooting], [Svc_Hardware], [Svc_DataBackup], [Svc_Software], [Svc_Upgrade], [Description], [Note], [StartDate], [FinishDate], [ID_PickUp], [URLAttachment] FROM [dbo].[Work Order] WHERE [ID] = " + _ID + "";
				CommStr[1] = "INSERT INTO [dbo].[Work Order] ([ID], [NoWO], [Date], [ID_LabelName], [ID_Vendor], [Name], [PIC], [Svc_SysConfig], [Svc_Troubleshooting], [Svc_Hardware], [Svc_DataBackup], [Svc_Software], [Svc_Upgrade], [Description], [Note], [StartDate], [FinishDate], [ID_PickUp], [URLAttachment]) VALUES(" + _ID + ", '" + _NoWO.Replace("'","''") + "', '" + _Date + "', " + _ID_LabelName + ", " + _ID_Vendor + ", '" + _Name.Replace("'","''") + "', '" + _PIC.Replace("'","''") + "', " + _Svc_SysConfig + ", " + _Svc_Troubleshooting + ", " + _Svc_Hardware + ", " + _Svc_DataBackup + ", " + _Svc_Software + ", " + _Svc_Upgrade + ", '" + _Description.Replace("'","''") + "', '" + _Note.Replace("'","''") + "', '" + _StartDate + "', '" + _FinishDate + "', " + _ID_PickUp + ", '" + _URLAttachment.Replace("'","''") + "')";
				CommStr[2] = "UPDATE [dbo].[Work Order] SET [NoWO] = '" + _NoWO.Replace("'","''") + "' ,[Date] = '" + _Date + "' ,[ID_LabelName] = " + _ID_LabelName + " ,[ID_Vendor] = " + _ID_Vendor + " ,[Name] = '" + _Name.Replace("'","''") + "' ,[PIC] = '" + _PIC.Replace("'","''") + "' ,[Svc_SysConfig] = " + _Svc_SysConfig + " ,[Svc_Troubleshooting] = " + _Svc_Troubleshooting + " ,[Svc_Hardware] = " + _Svc_Hardware + " ,[Svc_DataBackup] = " + _Svc_DataBackup + " ,[Svc_Software] = " + _Svc_Software + " ,[Svc_Upgrade] = " + _Svc_Upgrade + " ,[Description] = '" + _Description.Replace("'","''") + "' ,[Note] = '" + _Note.Replace("'","''") + "' ,[StartDate] = '" + _StartDate + "' ,[FinishDate] = '" + _FinishDate + "' ,[ID_PickUp] = " + _ID_PickUp + " ,[URLAttachment] = '" + _URLAttachment.Replace("'","''") + "' WHERE [ID] = " + _ID + "";
				CommStr[3] = "DELETE FROM [dbo].[Work Order] WHERE [ID] = " + _ID + "";
				return CommStr;
			}
			catch (System.Exception )
			{
				throw;
			}
		}
		#endregion
		
		#region Private Methods
		private void AddFromRecordSet(SqlDataReader rs)
		{
			try
			{
				// if value from the recordset, to the ID field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("ID")) == false))
				{
					ID = rs.GetGuid(rs.GetOrdinal("ID"));
				}
				// if value from the recordset, to the NoWO field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("NoWO")) == false))
				{
					NoWO = rs.GetString(rs.GetOrdinal("NoWO"));
				}
				// if value from the recordset, to the Date field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Date")) == false))
				{
					Date = rs.GetDateTime(rs.GetOrdinal("Date"));
				}
				// if value from the recordset, to the ID_LabelName field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("ID_LabelName")) == false))
				{
					ID_LabelName = rs.GetGuid(rs.GetOrdinal("ID_LabelName"));
				}
				// if value from the recordset, to the ID_Vendor field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("ID_Vendor")) == false))
				{
					ID_Vendor = rs.GetGuid(rs.GetOrdinal("ID_Vendor"));
				}
				// if value from the recordset, to the Name field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Name")) == false))
				{
					Name = rs.GetString(rs.GetOrdinal("Name"));
				}
				// if value from the recordset, to the PIC field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("PIC")) == false))
				{
					PIC = rs.GetString(rs.GetOrdinal("PIC"));
				}
				// if value from the recordset, to the Svc_SysConfig field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Svc_SysConfig")) == false))
				{
					Svc_SysConfig = rs.GetBoolean(rs.GetOrdinal("Svc_SysConfig"));
				}
				// if value from the recordset, to the Svc_Troubleshooting field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Svc_Troubleshooting")) == false))
				{
					Svc_Troubleshooting = rs.GetBoolean(rs.GetOrdinal("Svc_Troubleshooting"));
				}
				// if value from the recordset, to the Svc_Hardware field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Svc_Hardware")) == false))
				{
					Svc_Hardware = rs.GetBoolean(rs.GetOrdinal("Svc_Hardware"));
				}
				// if value from the recordset, to the Svc_DataBackup field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Svc_DataBackup")) == false))
				{
					Svc_DataBackup = rs.GetBoolean(rs.GetOrdinal("Svc_DataBackup"));
				}
				// if value from the recordset, to the Svc_Software field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Svc_Software")) == false))
				{
					Svc_Software = rs.GetBoolean(rs.GetOrdinal("Svc_Software"));
				}
				// if value from the recordset, to the Svc_Upgrade field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Svc_Upgrade")) == false))
				{
					Svc_Upgrade = rs.GetBoolean(rs.GetOrdinal("Svc_Upgrade"));
				}
				// if value from the recordset, to the Description field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Description")) == false))
				{
					Description = rs.GetString(rs.GetOrdinal("Description"));
				}
				// if value from the recordset, to the Note field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("Note")) == false))
				{
					Note = rs.GetString(rs.GetOrdinal("Note"));
				}
				// if value from the recordset, to the StartDate field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("StartDate")) == false))
				{
					StartDate = rs.GetDateTime(rs.GetOrdinal("StartDate"));
				}
				// if value from the recordset, to the FinishDate field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("FinishDate")) == false))
				{
					FinishDate = rs.GetDateTime(rs.GetOrdinal("FinishDate"));
				}
				// if value from the recordset, to the ID_PickUp field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("ID_PickUp")) == false))
				{
					ID_PickUp = rs.GetGuid(rs.GetOrdinal("ID_PickUp"));
				}
				// if value from the recordset, to the URLAttachment field is NOT null then set the value.
				if ((rs.IsDBNull(rs.GetOrdinal("URLAttachment")) == false))
				{
					URLAttachment = rs.GetString(rs.GetOrdinal("URLAttachment"));
				}
			}
			catch (SqlException sqlExc)
			{
				throw sqlExc;
			}
			catch (Exception Exc)
			{
				throw Exc;
			}
		}
		
		private SqlParameter[] GetSqlParameters()
		{
			List<SqlParameter> SqlParmColl = new List<SqlParameter>();
			try
			{
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@ID", ID, SqlDbType.UniqueIdentifier));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@NoWO", NoWO, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Date", Date, SqlDbType.DateTime));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@ID_LabelName", ID_LabelName, SqlDbType.UniqueIdentifier));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@ID_Vendor", ID_Vendor, SqlDbType.UniqueIdentifier));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Name", Name, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@PIC", PIC, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Svc_SysConfig", Svc_SysConfig, SqlDbType.Bit));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Svc_Troubleshooting", Svc_Troubleshooting, SqlDbType.Bit));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Svc_Hardware", Svc_Hardware, SqlDbType.Bit));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Svc_DataBackup", Svc_DataBackup, SqlDbType.Bit));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Svc_Software", Svc_Software, SqlDbType.Bit));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Svc_Upgrade", Svc_Upgrade, SqlDbType.Bit));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Description", Description, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@Note", Note, SqlDbType.VarChar));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@StartDate", StartDate, SqlDbType.DateTime));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@FinishDate", FinishDate, SqlDbType.DateTime));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@ID_PickUp", ID_PickUp, SqlDbType.UniqueIdentifier));
				SqlParmColl.Add(InventoryManagement.AddSqlParm("@URLAttachment", URLAttachment, SqlDbType.VarChar));
				return SqlParmColl.ToArray();
			}
			catch (Exception Exc)
			{
				throw Exc;
			}
		}
		#endregion
	}
	
	public class Work_OrderCollection : System.Collections.CollectionBase
	{
		
		[Description("Adds a new Work_Order to the collection.")]
		public int Add(Work_Order item)
		{
			int newindex = List.Add(item);
			return newindex;
		}
		
		[Description("Removes a Work_Order from the collection.")]
		public void Remove(Work_Order item)
		{
			List.Remove(item);
		}
		
		[Description("Inserts an Work_Order into the collection at the specified index.")]
		public void Insert(int index, Work_Order item)
		{
			List.Insert(index, item);
		}
		
		[Description("Returns the index value of the Work_Order class in the collection.")]
		public int IndexOf(Work_Order item)
		{
			return List.IndexOf(item);
		}
		
		[Description("Returns true if the Work_Order class is present in the collection.")]
		public bool Contains(Work_Order item)
		{
			return List.Contains(item);
		}
	}
	
	public enum Work_Order_Fields
	{
		
		ID,
		
		NoWO,
		
		Date,
		
		ID_LabelName,
		
		ID_Vendor,
		
		Name,
		
		PIC,
		
		Svc_SysConfig,
		
		Svc_Troubleshooting,
		
		Svc_Hardware,
		
		Svc_DataBackup,
		
		Svc_Software,
		
		Svc_Upgrade,
		
		Description,
		
		Note,
		
		StartDate,
		
		FinishDate,
		
		ID_PickUp,
		
		URLAttachment,
	}
}
